package com.gitee.wsl.flowing.actionflow.type


enum class ActivityStatus (val key: Int,
                           val value: String){
    SUSPENDED(0, "挂起"),

    ACTIVITY(1, "激活");

    companion object {
        fun getKeyByValue(value: String?): Int? {
            for (item in entries) {
                if (item.value == value) {
                    return item.key
                }
            }
            return null
        }

        fun getValueByKey(Key: Int?): String? {
            for (item in entries) {
                if (item.key == Key) {
                    return item.value
                }
            }
            return null
        }

        fun getByKey(key: Int?): ActivityStatus? {
            for (item in entries) {
                if (item.key == key) {
                    return item
                }
            }
            return null
        }

        /**
         * 判断流程是否激活
         * @param Key
         * @return
         */
        fun isActivity(Key: Int): Boolean {
            return ACTIVITY.key == Key
        }
    }
}
